package work;

public class Demo {
    //匿名内部类课堂练习
    public static void main(String[] args) {
        new UseCompute(){}.useCom(new Compute() {
            @Override
            public int computer(int n, int m) {
                return n + m;
            }
        }, 1, 2);
        new UseCompute(){}.useCom(new Compute() {
            @Override
            public int computer(int n, int m) {
                return n - m;
            }
        }, 4, 2);
        new UseCompute(){}.useCom(new Compute() {
            @Override
            public int computer(int n, int m) {
                return n * m;
            }
        }, 2, 3);
        new UseCompute(){}.useCom(new Compute() {
            @Override
            public int computer(int n, int m) {
                return n / m;
            }
        }, 3, 2);
    }
}